﻿<UserControl x:Class="ClearLines.Stocks.UserInterface.TaskPaneView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
   <Grid Margin="5">
      <Grid.Resources>
         <BooleanToVisibilityConverter x:Key="BoolToVisConverter"/>
      </Grid.Resources>
      <StackPanel>
         <Label FontWeight="Bold">Load History</Label>
         <StackPanel Orientation="Horizontal">
            <TextBox Text="{Binding SymbolToLoad}" Width="120" Height="25"></TextBox>
            <Button Command="{Binding LoadSymbol}" Width="70" Height="35">Load</Button>
         </StackPanel>

         <StackPanel Orientation="Horizontal">
            <Label Content="From" Width="50"/>
            <DatePicker SelectedDate="{Binding StartDate}"/>
         </StackPanel>
         <StackPanel Orientation="Horizontal">
            <Label Content="To" Width="50"/>
            <DatePicker SelectedDate="{Binding EndDate}"/>
         </StackPanel>

         <Label FontWeight="Bold">Selected Stock</Label>
         <Label Content="{Binding SelectedStock.Symbol}" Height="25"/>

         <StackPanel Margin="5">
            <StackPanel Orientation="Horizontal">
               <Label>Runs</Label>
               <TextBox Text="{Binding Runs}" Width="60" Height="25"/>
               <Button Command="{Binding SimulateStock}" Width="70" Height="35">Simulate</Button>
            </StackPanel>
            <ProgressBar Height="20" 
                         Visibility="{Binding IsSimulationRunning, Converter={StaticResource BoolToVisConverter}}" 
                         IsIndeterminate="True"/>
         </StackPanel>

         <StackPanel>
            <Label FontWeight="Bold">Loaded Stocks</Label>
            <ListView ItemsSource="{Binding Stocks}" 
                      SelectedItem="{Binding SelectedStock}" 
                      Height="300">
               <ListView.ItemTemplate>
                  <DataTemplate>
                     <Border Height="35">
                        <StackPanel>
                           <TextBlock Text="{Binding Symbol}" FontSize="12"/>
                           <StackPanel Orientation="Horizontal">
                              <TextBlock Text="{Binding StartDate, StringFormat={}{0:dd-MMM-yyyy}}" FontSize="9"/>
                              <TextBlock Text=" - " FontSize="9"/>
                              <TextBlock Text="{Binding EndDate, StringFormat={}{0:dd-MMM-yyyy}}" FontSize="9"/>
                           </StackPanel>
                        </StackPanel>
                     </Border>
                  </DataTemplate>
               </ListView.ItemTemplate>
            </ListView>
         </StackPanel>
      </StackPanel>
   </Grid>
</UserControl>